#include "bus.h"

//匹配设备和驱动
static int mybus_match(struct device *dev, struct device_driver *drv)
{
    //返回非0值表示匹配成功
    return 1;
}

struct bus_type mybus = {
    .name = "mybus",
    .match = mybus_match,
};
EXPORT_SYMBOL(mybus);

static int __init bus_init(void)
{
    //注册总线
    return bus_register(&mybus);
}

static void __exit bus_exit(void)
{
    //注销总线
    bus_unregister(&mybus);
}

module_init(bus_init);
module_exit(bus_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("lf");
MODULE_DESCRIPTION("This module is mybus");
MODULE_ALIAS("mybus");
